//
//  SLMP4Object.h
//  SLVideoParser
//
//  Created by S_LINE on 2020/6/18.
//  Copyright © 2020 S_LINE. All rights reserved.
//

#import <Foundation/Foundation.h>

@class SLMP4BoxHeader;

@interface SLMP4Box : NSObject

@property (nonatomic, assign) uint64_t offset;
@property (nonatomic, strong) SLMP4BoxHeader *header;
@property (nonatomic, strong) NSData *body;
@property (nonatomic, copy) NSArray<SLMP4Box *> *boxes;
@property (nonatomic, copy) NSDictionary *dicValue;

- (void)printBox;

@end

typedef NS_ENUM(NSUInteger, SLMP4BoxType) {
    SLMP4BoxType_none,
    SLMP4BoxType_ftyp,
    SLMP4BoxType_free,
    SLMP4BoxType_mdat,
    SLMP4BoxType_moov,
    // moov or trak sub
    SLMP4BoxType_mvhd,
    SLMP4BoxType_trak,
    SLMP4BoxType_udta,
    // trak sub
    SLMP4BoxType_tkhd,
    SLMP4BoxType_edts,
    SLMP4BoxType_mdia,
    // mdia sub
    SLMP4BoxType_mdhd,
    SLMP4BoxType_hdlr,
    SLMP4BoxType_minf,
    // minf sub
    SLMP4BoxType_vmhd,
    SLMP4BoxType_smhd,
    SLMP4BoxType_dinf,
    SLMP4BoxType_stbl,
    // dinf sub
    SLMP4BoxType_dref,
    // stbl sub
    SLMP4BoxType_stsd,
    SLMP4BoxType_stts,
    SLMP4BoxType_stss,
    SLMP4BoxType_ctts,
    SLMP4BoxType_stsc,
    SLMP4BoxType_stsz,
    SLMP4BoxType_stco,
    SLMP4BoxType_sgpd,
    SLMP4BoxType_sbgp,
    // udta sub
    SLMP4BoxType_meta,
    // edts sub
    SLMP4BoxType_elst
};

@interface SLMP4BoxHeader : NSObject

@property (nonatomic, assign) uint64_t size;
@property (nonatomic, assign) SLMP4BoxType type;
@property (nonatomic, copy) NSString *typeDesc;

@end
